﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using StockFinder.StockLists.SymbolListEnumerators;
using StockFinder.Model;
using StockFinder.Network;
using HtmlAgilityPack;

namespace StockFinder.StockLists.Indexes
{
    public class LseOnlineFtse100StockList : YahooFinanceOnlinePriceLoaderSymbolListEnumerator
    {
        private readonly string[] _Urls = new[]
        {
            "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=1",
            "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=2",
            "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=3",
            "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=4",
            "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=5",
            "http://www.londonstockexchange.com/exchange/prices-and-markets/stocks/indices/summary/summary-indices-constituents.html?index=UKX&page=6"
        };

        protected override List<Symbol> GetSymbols()
        {
            var stockIndexList = new List<Symbol>();

            foreach (var url in _Urls)
            {
                using (var webClient = new ProxiedWebClient())
                {
                    string pageSource = webClient.DownloadString(url);

                    var doc = new HtmlDocument();
                    doc.LoadHtml(pageSource);


                }
            }

            return stockIndexList;
        }
    }
}
